package com.xmb.common.log;

import ch.qos.logback.classic.pattern.ClassicConverter;
import ch.qos.logback.classic.spi.ILoggingEvent;
import com.alibaba.fastjson.JSON;

/**
 * Created by lyndon
 * logback自定义输出msg转换器.
 */
public class MyMessageConverter extends ClassicConverter {

    @Override
    public String convert(ILoggingEvent loggingEvent) {
        String originMsg = loggingEvent.getFormattedMessage();
        originMsg = originMsg.replaceAll("\n", " ");
        return JSON.toJSONString(originMsg);
    }
}
